package com.settlement.system.controller;

import com.settlement.system.model.entity.common.TblResponsibleReasonDtl;
import com.settlement.system.service.IBaseService;
import com.settlement.system.service.ITblResponsibleReasonDtlService;
import com.settlement.system.common.util.common.GenerateBillNoUtil;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;

/**
 * 损失原因细则对应表 前端控制器
 * @author xiaochuan
 * @since 2020-10-10
 */

@Api(tags = "损失原因细则对应表",description = "损失原因细则对应表")
@RestController
@RequestMapping("/responsible/reason/dtl")
public class TblResponsibleReasonDtlController extends BaseController<TblResponsibleReasonDtl> {

    @Resource
    private ITblResponsibleReasonDtlService tblResponsibleReasonDtlService;

    @Override
    public IBaseService init() {
        return tblResponsibleReasonDtlService;
    }

    @Override
    protected void setModelValue(TblResponsibleReasonDtl model) throws Exception {
        String lossReasonNo = model.getLossReasonDtlNo();
        if(StringUtils.isEmpty(lossReasonNo)){
            String lossReasonDtlNo = GenerateBillNoUtil.getUinquelossReasonDtlNo("LRSDTL");
            model.setLossReasonDtlNo(lossReasonDtlNo);
        }
    }

}

